<?php
namespace Orm\Staff;

class StaffModel extends \Base\BaseOrmModel{

    function __construct()
    {
        parent::__construct();
        $this->table = 't_staff';
    }

    /**
     * @param $account
     * @param $userType
     * @return array
     */
    public function getStaffByAccount($account, $userType){
        $sql = "SELECT * FROM ".$this->table." WHERE `account` = '".$account."' AND `type`=".$userType." AND `is_del` = 0";
        return $this->_fetch($sql,0);
    }

    /**
     * @param $account
     * @return array
     * @throws \Base\Exception\NoRecordException
     */
    public function loadByLoginAccount($account)
    {
        $sql = "SELECT * FROM ".$this->table." WHERE `account` = '".$account."' AND `is_del` = 0";
        $result = $this->_fetch($sql,0);
        return !empty($result) ? $result : array();
    }

}